#pragma once
#include <yaml-cpp/yaml.h>
#include <string>
#include "smart_car.h"

// 文件的保存和读入管理模块
class FileManager {
public:
    FileManager(int carCount);
    void setCars(std::vector<SmartCar>& cars);
    void saveToFile(std::string dirName);
    void loadFromFile(std::string dirName);
    std::vector<SmartCar>& getSmartCars();

private:
    std::vector<SmartCar> _cars;
    std::vector<SmartCar> _carsFromFile;
    int _carCount;
    void deserializeSmartCar(YAML::Node& node, SmartCar& car);
};
